﻿﻿﻿﻿<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
<div id="createDialog" class="crudDialog">
	<form id="createForm" action="${basePath}/manage/goods/create" method="post" enctype="multipart/form-data">
		<input type="hidden" name="userId" value="1">
		<div class="row">
													<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="name">商品名称</label>
						<input id="name" type="text" class="form-control" name="name" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="typeId">分类_id</label>
						<input id="typeId" type="text" class="form-control" name="typeId" maxlength="200">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="brandId">品牌_id</label>
						<input id="brandId" type="text" class="form-control" name="brandId" maxlength="200">
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="gPicture">图片</label>
						<input type="file" class="form-control"  name="gPicture"/>
					</div>
				</div>
			</div>
			<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="weight">商品重量(g)</label>
						<input id="weight" type="text" class="form-control" name="weight" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="isShelf">是否上架(1：上架，2：下架)</label>
						<input id="isShelf" type="text" class="form-control" name="isShelf" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="score">可得积分</label>
						<input id="score" type="text" class="form-control" name="score" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="alertStock">警戒库存</label>
						<input id="alertStock" type="text" class="form-control" name="alertStock" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="pageTitle">页面标题</label>
						<input id="pageTitle" type="text" class="form-control" name="pageTitle" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="pageKewords">页面关键词</label>
						<input id="pageKewords" type="text" class="form-control" name="pageKewords" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="pageDescripte">页面描述</label>
						<input id="pageDescripte" type="text" class="form-control" name="pageDescripte" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="shareContent">分享内容</label>
						<input id="shareContent" type="text" class="form-control" name="shareContent" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="details">商品详情</label>
						<input id="details" type="text" class="form-control" name="details" maxlength="200">
					</div>
				</div>
			</div>
											<div class="col-sm-12">
				<div class="form-group">
					<div class="fg-line">
						<label for="afterSaleServices">售后服务</label>
						<input id="afterSaleServices" type="text" class="form-control" name="afterSaleServices" maxlength="200">
					</div>
				</div>
			</div>

		<div class="form-group text-right dialog-buttons">
			<a class="waves-effect waves-button" href="javascript:;" onclick="createSubmit();">保存</a>
			<a class="waves-effect waves-button" href="javascript:;" onclick="createDialog.close();">取消</a>
		</div>
	</form>
</div>
<script>
function createSubmit() {
	
	$("#createForm").ajaxSubmit({
		beforeSerialize: function($form, options) {
		},
		beforeSubmit: function(arr, $form, options) {
		},
		success: function(result) {
			if (result.code != 1) {
				if (result.data instanceof Array) {
					$.each(result.data, function(index, value) {
						$.confirm({
							theme: 'dark',
							animation: 'rotateX',
							closeAnimation: 'rotateX',
							title: false,
							content: value.errorMsg,
							buttons: {
								confirm: {
									text: '确认',
									btnClass: 'waves-effect waves-button waves-light'
								}
							}
						});
					});
				} else {
					$.confirm({
							theme: 'dark',
							animation: 'rotateX',
							closeAnimation: 'rotateX',
							title: false,
							content: result.data.errorMsg,
							buttons: {
								confirm: {
									text: '确认',
									btnClass: 'waves-effect waves-button waves-light'
								}
							}
						});
				}
			} else {
				createDialog.close();
				$table.bootstrapTable('refresh');
			}
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
        	$.confirm({
				theme: 'dark',
				animation: 'rotateX',
				closeAnimation: 'rotateX',
				title: false,
				content: textStatus,
				buttons: {
					confirm: {
						text: '确认',
						btnClass: 'waves-effect waves-button waves-light'
					}
				}
			});
        }
	});
}
</script>